import django_filters
from .models import *

class OrderFilter(django_filters.rest_framework.FilterSet):
    """过滤器"""

    orderId = django_filters.CharFilter(lookup_expr='icontains')
    memberCode = django_filters.CharFilter(field_name='user__code')
    parentCode = django_filters.CharFilter(field_name='user__parent__code')
    memberPhone = django_filters.CharFilter(lookup_expr='icontains', field_name='user__phone')
    startTime = django_filters.DateFilter(field_name='payTime', help_text="开始时间", lookup_expr='gte')
    endTime = django_filters.DateFilter(field_name='payTime', help_text="结束时间", lookup_expr='lte')

    class Meta:
        model = Order
        fields = '__all__'